<?php 
    if(isset($_REQUEST['date'])){
        $time_request = strtotime($_REQUEST['date']);
        $now = date("D M-d", $time_request);
        $previous = mktime(0,0,0,date("m", $time_request),date("d", $time_request)-1,date("Y", $time_request));
        $next = mktime(0,0,0,date("m", $time_request),date("d", $time_request)+1,date("Y", $time_request));
    }else{
        $previous = mktime(0,0,0,date("m"),date("d")-1,date("Y"));
    }
?>
<div class="page page-top">
    <div class="pagination">
        <a href="<?php echo $this->baseUrl; ?>explore/highlights?date=<?php echo date("Y-m-d", $previous); ?>" class="previous_page"><strong><?php echo date("D", $previous); ?></strong> <?php echo date("M-d", $previous); ?></a>
        <span class="calendar"><?php 
        if(isset($_REQUEST['date'])) 
            if(Utils::compareDate(date("Y-m-d"), date("Y-m-d", $time_request))) 
                echo "Today"; 
            else 
                echo $now; 
        else
            echo "Today"; 
        ?></span>
        <a style="<?php 
        if(isset($_REQUEST['date'])){
            if(Utils::compareDate(date("Y-m-d"), date("Y-m-d", $time_request))) 
                echo "display: none;"; 
            else 
                echo "display: initial;"; 
        }else{
            echo "display: none;";
        }
        ?>" href="<?php echo $this->baseUrl; ?>explore/highlights?date=<?php if(isset($_REQUEST['date'])) echo date("Y-m-d", $next); ?>" class="next_page"><?php 
        if(isset($_REQUEST['date'])) 
            if(Utils::compareDate(date("Y-m-d"), date("Y-m-d", $next))) 
                echo "Today"; 
            else 
                echo date("D M-d", $next); 
        else
            echo "Today"; 
        ?></a>
    </div>
</div>

<ul class="tabs">
    <li <?php if (strtoupper($this->params[1]) == 'HIGHLIGHTS') echo 'class="active"' ?>>
        <a href="<?php echo $this->baseUrl ?>explore/highlights">Highlights</a>
    </li>
   <li <?php if (strtoupper($this->params[1]) == 'COLORS') echo 'class="active"' ?>>
        <a href="<?php echo $this->baseUrl ?>explore/colors">Colors</a>
    </li>
</ul>

<div class="group highlights">
    <div class="multi group">
        <h3 class="special">
            <span class="special-flag special-featured">Popular</span>
            See all for <a href="<?php echo $this->baseUrl ?>shots/popular?date=<?php echo date("Y-m-d");?>&&page=1" class="date-more">Today</a>
        </h3>
        <ol class="dribbbles group" style="
            <?php 
                if(isset($_REQUEST['date'])){
                    $statusid = Status::getStatusTopView($_REQUEST['date']);
                    if($statusid != FALSE){
                        echo "display: inherit;";
                    }else{
                        echo "display: none;";
                    }
                }
            ?>">
            <?php 
            if(isset($_REQUEST['date'])){
                $statusid = Status::getStatusTopView($_REQUEST['date']);
                if($statusid != FALSE){
                    $photoid = Photo::getPhotoId($statusid);
                    $photo = Photo::withId($photoid);
                    $status = Status::withId($statusid);
                    $user = User::withId($status->userid);
                    $avatar = $user->avatar;
                    if($status->visibility == 0)
                        $visibility = "hidden";
                    else
                        $visibility = "visible";
                    echo '<li id="screenshot-1334669" class="group ">
                                <div class="dribbble">
                                <div class="dribbble-shot">
                                <div class="dribbble-img">
                                <a href="/shots/1334669-Logos-2013" class="dribbble-link"><div data-picture="" data-alt="Logos - 2013">
                                <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                (min--moz-device-pixel-ratio: 1.5),
                                (-o-min-device-pixel-ratio: 3/2),
                                (min-device-pixel-ratio: 1.5),
                                (min-resolution: 1.5dppx)"></div>
                                <img alt="'.$photo->title.'" src="'.$this->baseUrl.$photo->url.'"></div>
                                </a>
                                <a href="'.$this->baseUrl."Shots/".$photo->alias.'" class="dribbble-over" style="opacity: 0;"><strong>'.$status->title.'</strong>
                                <span class="comment">'.$status->content.' </span>
                                <em class="timestamp">'.$status->datecreated.'</em>
                                </a></div>
                                <ul class="tools group" style="visibility: '.$visibility.';">
                                <li class="fav">
                                <a href="/shots/1334669-Logos-2013/fans" title="See fans of this screenshot">254</a>
                                </li>
                                <li class="cmnt">
                                <a href="/shots/1334669-Logos-2013#comments" title="View comments on this screenshot">'.$status->replies.'</a>
                                </li>
                                <li class="views">'.$status->view.'</li>
                                </ul>
                                </div>
                                <div class="extras">
                                <a href="/shots/1334669-Logos-2013/rebounds">
                                <span rel="tipsy" class="rebound-mark has-rebounds" original-title="This shot has rebounds.">0</span>
                                </a><a href="/shots/popular">
                                <span rel="tipsy" class="rebound-mark is-rebound" original-title="This shot is a rebound (reply) of another shot. The icon links to the original.">
                                <img alt="Rebound" height="16" src="http://assets1.dribbble.com/assets/icon-rebound-2x-a86d01cb624d76aec3d2974d3128782c.png" width="16">
                                </span>
                                </a><span rel="tipsy" class="attachments-mark" original-title="This shot has attachments">
                                <img alt="Attachments" height="16" src="http://assets2.dribbble.com/assets/icon-attach-16-2x-d4551c7e83546236d3f67c3fa6795831.png" width="16">
                                </span>
                                </div></div>
                                <h2>
                                <span class="attribution-user">
                                <a href="'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$avatar->url.'">'.$user->username.'</a>
                                </span>
                                </h2>
                            </li>';
                }
            }
            else{
                $statusid = Status::getStatusTopView(date("Y-m-d"));
                $photoid = Photo::getPhotoId($statusid);
                if($photoid != NULL){
                    $photo = Photo::withId($photoid);
                    $status = Status::withId($statusid);
                    $user = User::withId($status->userid);
                    $avatar = $user->avatar;
                    if($status->visibility == 0)
                        $visibility = "hidden";
                    else
                        $visibility = "visible";
                    echo '<li id="screenshot-1334669" class="group ">
                                <div class="dribbble">
                                <div class="dribbble-shot">
                                <div class="dribbble-img">
                                <a href="/shots/1334669-Logos-2013" class="dribbble-link"><div data-picture="" data-alt="Logos - 2013">
                                <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                (min--moz-device-pixel-ratio: 1.5),
                                (-o-min-device-pixel-ratio: 3/2),
                                (min-device-pixel-ratio: 1.5),
                                (min-resolution: 1.5dppx)"></div>
                                <img alt="'.$photo->title.'" src="'.$this->baseUrl.$photo->url.'"></div>
                                </a>
                                <a href="'.$this->baseUrl."Shots/".$photo->alias.'" class="dribbble-over" style="opacity: 0;"><strong>'.$status->title.'</strong>
                                <span class="comment">'.$status->content.' </span>
                                <em class="timestamp">'.$status->datecreated.'</em>
                                </a></div>
                                <ul class="tools group" style="visibility: '.$visibility.';">
                                <li class="fav">
                                <a href="/shots/1334669-Logos-2013/fans" title="See fans of this screenshot">254</a>
                                </li>
                                <li class="cmnt">
                                <a href="/shots/1334669-Logos-2013#comments" title="View comments on this screenshot">'.$status->replies.'</a>
                                </li>
                                <li class="views">'.$status->view.'</li>
                                </ul>
                                </div>
                                <div class="extras">
                                <a href="/shots/1334669-Logos-2013/rebounds">
                                <span rel="tipsy" class="rebound-mark has-rebounds" original-title="This shot has rebounds.">0</span>
                                </a><a href="/shots/popular">
                                <span rel="tipsy" class="rebound-mark is-rebound" original-title="This shot is a rebound (reply) of another shot. The icon links to the original.">
                                <img alt="Rebound" height="16" src="http://assets1.dribbble.com/assets/icon-rebound-2x-a86d01cb624d76aec3d2974d3128782c.png" width="16">
                                </span>
                                </a><span rel="tipsy" class="attachments-mark" original-title="This shot has attachments">
                                <img alt="Attachments" height="16" src="http://assets2.dribbble.com/assets/icon-attach-16-2x-d4551c7e83546236d3f67c3fa6795831.png" width="16">
                                </span>
                                </div></div>
                                <h2>
                                <span class="attribution-user">
                                <a href="'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$avatar->url.'">'.$user->username.'</a>
                                </span>
                                </h2>
                            </li>';
                }
            }
            ?>
        </ol>

        <ol class="multi-grid">
            <?php 
            if(isset($_REQUEST['date'])){
                $statuses = Status::getStatusByViewByDate(1, 8, $_REQUEST['date']);
                if($statuses != FALSE){
                    $arr_status = explode(";", $statuses);
                    for($i = 0; $i < sizeof($arr_status) - 1; $i++){
                        $photoid = Photo::getPhotoId($arr_status[$i]);
                        $photo = Photo::withId($photoid);
                        $status = Status::withId($arr_status[$i]);
                        $user = User::withId($status->userid);
                        $avatar = $user->avatar;
                        echo '<li class="multi-thumb">
                                <a href="'.$this->baseUrl."Shots/".$photo->alias.'" class="zoom" original-title="">
                                    <strong style="opacity: 0;"><span>100</span></strong>
                                    <img alt="'.$photo->title.'" src="'.$this->baseUrl.$photo->url.'">
                                </a>    <div class="tipsy-player">
                                    <span class="tipsy-player-link"><a href="/'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><div data-picture="" data-alt="'.$user->username.'" data-class="photo">
                                                <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                                <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                                     (min--moz-device-pixel-ratio: 1.5),
                                                     (-o-min-device-pixel-ratio: 3/2),
                                                     (min-device-pixel-ratio: 1.5),
                                                     (min-resolution: 1.5dppx)"></div>
                                                <img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$photo->url.'"></div>
                                    '.$user->username.'</a></span>
                                </div>
                            </li>';
                    }
                }
            }else{
                $statuses = Status::getStatusByViewByDate(1, 8, date("Y-m-d"));
                $arr_status = explode(";", $statuses);
                for($i = 0; $i < sizeof($arr_status) - 1; $i++){
                    $photoid = Photo::getPhotoId($arr_status[$i]);
                    $photo = Photo::withId($photoid);
                    $status = Status::withId($arr_status[$i]);
                    $user = User::withId($status->userid);
                    $avatar = $user->avatar;
                    echo '<li class="multi-thumb">
                            <a href="'.$this->baseUrl."Shots/".$photo->alias.'" class="zoom" original-title="">
                                <strong style="opacity: 0;"><span>100</span></strong>
                                <img alt="'.$photo->title.'" src="'.$this->baseUrl.$photo->url.'">
                            </a>    <div class="tipsy-player">
                                <span class="tipsy-player-link"><a href="/'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><div data-picture="" data-alt="'.$user->username.'" data-class="photo">
                                            <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                            <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                                 (min--moz-device-pixel-ratio: 1.5),
                                                 (-o-min-device-pixel-ratio: 3/2),
                                                 (min-device-pixel-ratio: 1.5),
                                                 (min-resolution: 1.5dppx)"></div>
                                            <img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$photo->url.'"></div>
                                '.$user->username.'</a></span>
                            </div>
                        </li>';
                }
            }
            ?>
        </ol>

    </div>
    <div class="multi group">
        <h3 class="special">
            <span class="special-flag special-featured">Debuts</span>
            See all for <a href="<?php echo $this->baseUrl; ?>shots/debuts?date=<?php echo date("Y-m-d");?>&&page=1" class="date-more">Today</a>
        </h3>

        <ol class="dribbbles group" style="
            <?php 
                if(isset($_REQUEST['date'])){
                    $statusid = Status::getStatusTopView($_REQUEST['date']);
                    if($statusid != FALSE){
                        echo "display: inherit;";
                    }else{
                        echo "display: none;";
                    }
                }
            ?>">
            <?php 
            if(isset($_REQUEST['date'])){
                $statusid = Status::getStatusTopNew($_REQUEST['date']);
                if($statusid != FALSE){
                    $photoid = Photo::getPhotoId($statusid);
                    $photo = Photo::withId($photoid);
                    $status = Status::withId($statusid);
                    $user = User::withId($status->userid);
                    $avatar = $user->avatar;
                    if($status->visibility == 0)
                        $visibility = "hidden";
                    else
                        $visibility = "visible";
                    echo '<li id="screenshot-1334669" class="group ">
                                <div class="dribbble">
                                <div class="dribbble-shot">
                                <div class="dribbble-img">
                                <a href="/shots/1334669-Logos-2013" class="dribbble-link"><div data-picture="" data-alt="Logos - 2013">
                                <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                (min--moz-device-pixel-ratio: 1.5),
                                (-o-min-device-pixel-ratio: 3/2),
                                (min-device-pixel-ratio: 1.5),
                                (min-resolution: 1.5dppx)"></div>
                                <img alt="Logos - 2013" src="'.$this->baseUrl.$photo->url.'"></div>
                                </a>
                                <a href="'.$this->baseUrl."Shots/".$photo->url.'" class="dribbble-over" style="opacity: 0;"><strong>'.$status->title.'</strong>
                                <span class="comment">'.$status->content.' </span>
                                <em class="timestamp">'.$status->datecreated.'</em>
                                </a></div>
                                <ul class="tools group" style="visibility: '.$visibility.';">
                                <li class="fav">
                                <a href="/shots/1334669-Logos-2013/fans" title="See fans of this screenshot">254</a>
                                </li>
                                <li class="cmnt">
                                <a href="/shots/1334669-Logos-2013#comments" title="View comments on this screenshot">'.$status->replies.'</a>
                                </li>
                                <li class="views">'.$status->view.'</li>
                                </ul>
                                </div>
                                <div class="extras">
                                <a href="/shots/1334669-Logos-2013/rebounds">
                                <span rel="tipsy" class="rebound-mark has-rebounds" original-title="This shot has rebounds.">0</span>
                                </a><a href="/shots/popular">
                                <span rel="tipsy" class="rebound-mark is-rebound" original-title="This shot is a rebound (reply) of another shot. The icon links to the original.">
                                <img alt="Rebound" height="16" src="http://assets1.dribbble.com/assets/icon-rebound-2x-a86d01cb624d76aec3d2974d3128782c.png" width="16">
                                </span>
                                </a><span rel="tipsy" class="attachments-mark" original-title="This shot has attachments">
                                <img alt="Attachments" height="16" src="http://assets2.dribbble.com/assets/icon-attach-16-2x-d4551c7e83546236d3f67c3fa6795831.png" width="16">
                                </span>
                                </div></div>
                                <h2>
                                <span class="attribution-user">
                                <a href="'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$avatar->url.'">'.$user->username.'</a>
                                </span>
                                </h2>
                            </li>';
                }
            }else{
                $statusid = Status::getStatusTopNew(date("Y-m-d"));
                $photoid = Photo::getPhotoId($statusid);
                if($photoid != NULL){
                    $photo = Photo::withId($photoid);
                    $status = Status::withId($statusid);
                    $user = User::withId($status->userid);
                    $avatar = $user->avatar;
                    if($status->visibility == 0)
                        $visibility = "hidden";
                    else
                        $visibility = "visible";
                    echo '<li id="screenshot-1334669" class="group ">
                                <div class="dribbble">
                                <div class="dribbble-shot">
                                <div class="dribbble-img">
                                <a href="/shots/1334669-Logos-2013" class="dribbble-link"><div data-picture="" data-alt="Logos - 2013">
                                <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                (min--moz-device-pixel-ratio: 1.5),
                                (-o-min-device-pixel-ratio: 3/2),
                                (min-device-pixel-ratio: 1.5),
                                (min-resolution: 1.5dppx)"></div>
                                <img alt="Logos - 2013" src="'.$this->baseUrl.$photo->url.'"></div>
                                </a>
                                <a href="'.$this->baseUrl."Shots/".$photo->url.'" class="dribbble-over" style="opacity: 0;"><strong>'.$status->title.'</strong>
                                <span class="comment">'.$status->content.' </span>
                                <em class="timestamp">'.$status->datecreated.'</em>
                                </a></div>
                                <ul class="tools group" style="visibility: '.$visibility.';">
                                <li class="fav">
                                <a href="/shots/1334669-Logos-2013/fans" title="See fans of this screenshot">254</a>
                                </li>
                                <li class="cmnt">
                                <a href="/shots/1334669-Logos-2013#comments" title="View comments on this screenshot">'.$status->replies.'</a>
                                </li>
                                <li class="views">'.$status->view.'</li>
                                </ul>
                                </div>
                                <div class="extras">
                                <a href="/shots/1334669-Logos-2013/rebounds">
                                <span rel="tipsy" class="rebound-mark has-rebounds" original-title="This shot has rebounds.">0</span>
                                </a><a href="/shots/popular">
                                <span rel="tipsy" class="rebound-mark is-rebound" original-title="This shot is a rebound (reply) of another shot. The icon links to the original.">
                                <img alt="Rebound" height="16" src="http://assets1.dribbble.com/assets/icon-rebound-2x-a86d01cb624d76aec3d2974d3128782c.png" width="16">
                                </span>
                                </a><span rel="tipsy" class="attachments-mark" original-title="This shot has attachments">
                                <img alt="Attachments" height="16" src="http://assets2.dribbble.com/assets/icon-attach-16-2x-d4551c7e83546236d3f67c3fa6795831.png" width="16">
                                </span>
                                </div></div>
                                <h2>
                                <span class="attribution-user">
                                <a href="'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$avatar->url.'">'.$user->username.'</a>
                                </span>
                                </h2>
                            </li>';
                }
            }
            ?>
        </ol>

        <ol class="multi-grid">
            <?php 
            if(isset($_REQUEST['date'])){
                $statuses = Status::getStatusByDate(1, 8, $_REQUEST['date']);
                if($statuses != FALSE){
                    $arr_status = explode(";", $statuses);
                    for($i = 0; $i < sizeof($arr_status) - 1; $i++){
                        $photoid = Photo::getPhotoId($arr_status[$i]);
                        $photo = Photo::withId($photoid);
                        $status = Status::withId($arr_status[$i]);
                        $user = User::withId($status->userid);
                        $avatar = $user->avatar;
                        echo '<li class="multi-thumb">
                                <a href="'.$this->baseUrl.$photo->url.'" class="zoom" original-title="">
                                    <strong style="opacity: 0;"><span>100</span></strong>
                                    <img alt="Speaker Wip 02 (3d)" src="'.$this->baseUrl.$photo->url.'">
                                </a>    <div class="tipsy-player">
                                    <span class="tipsy-player-link"><a href="/'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><div data-picture="" data-alt="'.$user->username.'" data-class="photo">
                                                <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                                <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                                     (min--moz-device-pixel-ratio: 1.5),
                                                     (-o-min-device-pixel-ratio: 3/2),
                                                     (min-device-pixel-ratio: 1.5),
                                                     (min-resolution: 1.5dppx)"></div>
                                                <img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$photo->url.'"></div>
                                    '.$user->username.'</a></span>
                                </div>
                            </li>';
                    }
                }
            }else{
                $statuses = Status::getStatusByDate(1, 8, date("Y-m-d"));
                $arr_status = explode(";", $statuses);
                for($i = 0; $i < sizeof($arr_status) - 1; $i++){
                    $photoid = Photo::getPhotoId($arr_status[$i]);
                    $photo = Photo::withId($photoid);
                    $status = Status::withId($arr_status[$i]);
                    $user = User::withId($status->userid);
                    $avatar = $user->avatar;
                    echo '<li class="multi-thumb">
                            <a href="'.$this->baseUrl.$photo->url.'" class="zoom" original-title="">
                                <strong style="opacity: 0;"><span>100</span></strong>
                                <img alt="Speaker Wip 02 (3d)" src="'.$this->baseUrl.$photo->url.'">
                            </a>    <div class="tipsy-player">
                                <span class="tipsy-player-link"><a href="/'.$this->baseUrl.$user->username.'" class="url" rel="contact" title="'.$user->username.'"><div data-picture="" data-alt="'.$user->username.'" data-class="photo">
                                            <div data-src="'.$this->baseUrl.$photo->url.'"></div>
                                            <div data-src="'.$this->baseUrl.$photo->url.'" data-media="(-webkit-min-device-pixel-ratio: 1.5),
                                                 (min--moz-device-pixel-ratio: 1.5),
                                                 (-o-min-device-pixel-ratio: 3/2),
                                                 (min-device-pixel-ratio: 1.5),
                                                 (min-resolution: 1.5dppx)"></div>
                                            <img alt="'.$user->username.'" class="photo" src="'.$this->baseUrl.$photo->url.'"></div>
                                '.$user->username.'</a></span>
                            </div>
                        </li>';
                }
            }
            ?>
        </ol>

    </div>

</div>
